<?php
/**
 * Feed
 * 
 * @version $Id$
 */

class Module_awards_login
{
	/**
	 * 构造函数
	 */
	function __construct() {
		
	}
	
	/**
	 * 我的登陆信息
	 */
	function info() {
		$uin = SessionInfo('uin');
		$smarty = loadSmarty();
		
		loadLib('Awards_Login');
		$awards_login = Awards_Login::getInfo($uin , true);
		$awards_money = Awards_Login::getAwardsMoney($awards_login['times']);
		$smarty->assign('awards_login' , $awards_login);
		$smarty->assign('awards_money' , $awards_money);
		
		return $smarty->fetch('awards/login/info.tpl.php');
	}
	
	/**
	 * 介绍
	 */
	function intro() {
		$smarty = loadSmarty();
		
		return $smarty->fetch('awards/login/intro.tpl.php');
	}
	
	/**
	 * 领取奖品
	 * Enter description here ...
	 */
	function getawrads() {
		$uin = SessionInfo('uin');
		$smarty = loadSmarty();
		
		loadLib('Awards_Login');
		$code = Awards_Login::addAwards($uin , $awards_login);
		if($code !== 0) {
			return View::error('系统错误，请稍后再试' , $code);
		}
		
		$awards_money = $awards_login['awards_money'];
		
		$smarty->assign('awards_login' , $awards_login);
		$smarty->assign('awards_money' , $awards_money);
		
		if(is_array($awards_login) && $awards_money <= 0) {
			return $smarty->fetch('awards/login/get_error.tpl.php');
		}
		
		return View::success('领奖成功，得到' . $awards_money . '金币' , array(
			array(
				'name' => '返回首页 ',
				'url' => SITEURL . '/?m=home&amp;sid=' . SessionInfo('skey'),
			),
			array(
				'name' => '去金库看看 ',
				'url' => SITEURL . '/?m=money&amp;sid=' . SessionInfo('skey'),
			)
		));
	}
}

# end of script
